﻿using System.Xml;
using NUnit.Framework;
using Whois.API;

namespace Tests.APITests
{
    [TestFixture]
    public class WhoisApiExceptionTests
    {

        [Test]
        public void XmlConstructor()
        {
            const string expected = "'.foo.com' is an invalid domain name";
            var error = new XmlDocument();
            error.LoadXml("<ErrorMessage><msg>"+expected+"</msg></ErrorMessage>");
            var exception = new WhoisApiException(error,null);
            Assert.AreEqual(expected, exception.MessageDetailed);
        }
    }
}
